home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1991-04-19 | 83.6 KB | 2,785 lines | [ TEXT/OMEG]
(*^ ::[paletteColors = 128; showRuler; fontset = title, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M18, N18, bold, e8, 24, "Times"; fontset = subtitle, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M18, N72, e6, 10, "Times"; fontset = subsubtitle, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M18, N5, e50, 9, "Times"; fontset = section, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, M18, O450, bold, a30, e8, 18, "Times"; fontset = subsection, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, blackBox, M18, N72, bold, a16, 14, "Times"; fontset = subsubsection, inactive, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, whiteBox, M18, bold, a16, 12, "Geneva"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, N3, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, 12, "Times"; fontset = input, nowordwrap, preserveAspect, groupLikeInput, M18, N23, bold, B65535, 10, "Courier"; fontset = output, output, inactive, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, R6185, G15986, B40959, 10, "Courier"; fontset = message, inactive, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, R65535, 10, "Courier"; fontset = print, inactive, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, 10, "Courier"; fontset = info, inactive, nowordwrap, preserveAspect, groupLikeOutput, M17, N23, 10, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, nowordwrap, preserveAspect, groupLikeGraphics, M18, w253, h254, 10, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, 9, "LO Univers 45 LightOblique"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M0, 10, "Times"; fontset = Left Header, nohscroll, M0, 12, "Palatino"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, M0, N72, 6, "B Univers 65 Bold"; fontset = Left Footer, center, M0, 12, "Palatino"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, 10, "Geneva"; fontset = clipboard, inactive, noKeepOnOnePage, preserveAspect, M0, 10, "New York"; fontset = completions, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, M0, 10, "New York"; fontset = special1, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, M0, N90, bold, L1, a2, 12, "Geneva"; fontset = special2, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, blackBox, M0, N90, a2, e2, 12, "B Palatino Bold"; fontset = special3, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, center, M-4, 12, "B Palatino Bold"; fontset = special4, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, right, M81, bold, 12, "Geneva"; fontset = special5, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, center, M81, 12, "Palatino";] :[font = title; inactive; preserveAspect; rightWrapOffset = 431; startGroup; ] A Sampling of Mathematica ;[s] 3:0,1;14,2;25,1;28,-1; 3:0,24,17,Courier,1,24,0,0,0;2,26,18,Times,1,24,0,0,0;1,26,18,Times,3,24,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This file is a Mathematica Notebook that gives some examples of what Mathematica can do. For information on how to read this Notebook, see the file Read This First! This file is loosely based on the “Tour of Mathematica” in Mathematica: A System for Doing Mathematics by Computer, Second Edition, by Stephen Wolfram. This book was published by Addison-Wesley in 1991, and is available at most bookstores. For information on how to obtain copies of Mathematica itself, see the section “Buying Mathematica ” in the file Read This First! ;[s] 18:0,0;15,1;26,0;69,1;80,0;150,2;167,0;211,1;223,0;229,1;240,0;242,1;284,0;455,1;466,0;500,1;512,0;526,2;543,-1; 3:9,14,9,Times,0,12,0,0,0;7,14,9,Times,2,12,0,0,0;2,14,9,Times,1,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Numerical Calculations :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] You can use Mathematica as an enhanced scientific calculator. Let's start with a simple example. ;[s] 5:0,0;12,1;23,0;82,2;83,0;100,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,0,12,65535,0,65535; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] 45 + 78 :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 123 ;[o] 123 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] The first line here is what you type into Mathematica. The second line is the result Mathematica gives. If you are reading this Notebook on a color system, the input and output are blue, with the input in boldface. ;[s] 5:0,0;42,1;53,0;86,1;97,0;218,-1; 2:3,14,9,Times,0,12,0,0,0;2,14,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now let's try something more difficult. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] 3^100 :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 515377520732011331036461129765621272702107522001 ;[o] 515377520732011331036461129765621272702107522001 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Unlike a calculator, Mathematica gives an exact answer for 3 raised to the power 100. ;[s] 3:0,0;21,1;32,0;87,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now let's really test out Mathematica. Here is 3 raised to the power 1000. ;[s] 3:0,0;26,1;37,0;76,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] 3^1000 :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 13220708194808066368904552597521443659654220327521481676649\ 2036822682859734670489954077831385060806196390977769687258\ 2355950954582100618911865342725257953674027620225198320803\ 8780147742289648412743904001175886180411289478156230944380\ 6156617305408667449050617812548034440554705439703889581746\ 5368254916136220830268563778582290228416398307887896918556\ 4040848989376093732421718463599386955167650189405881090604\ 2608967143886410281435038564874716583201061436613217310276\ 8902855220001 ;[o] 13220708194808066368904552597521443659654220327521481676649\ 2036822682859734670489954077831385060806196390977769687258\ 2355950954582100618911865342725257953674027620225198320803\ 8780147742289648412743904001175886180411289478156230944380\ 6156617305408667449050617812548034440554705439703889581746\ 5368254916136220830268563778582290228416398307887896918556\ 4040848989376093732421718463599386955167650189405881090604\ 2608967143886410281435038564874716583201061436613217310276\ 8902855220001 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This took about half a second on a Macintosh II. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here's the result in the form you might get on a calculator. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] N[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] "1.32207"*10^"477" ;[o] 477 1.32207 10 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here is the value of pi to two hundred decimal places. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] N[Pi, 200] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 3.141592653589793238462643383279502884197169399375105820974\ 9445923078164062862089986280348253421170679821480865132823\ 0664709384460955058223172535940812848111745028410270193852\ 1105559644622948954930382 ;[o] 3.141592653589793238462643383279502884197169399375105820974\ 9445923078164062862089986280348253421170679821480865132823\ 0664709384460955058223172535940812848111745028410270193852\ 1105559644622948954930382 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica knows about a big collection of mathematical functions — most of those you would find in any book of mathematical tables. ;[s] 2:0,1;11,0;135,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] BesselJ[5, 34.6] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 0.0511826 ;[o] 0.0511826 :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Log[4.5 + 2I] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 1.59421 + 0.418224*I ;[o] 1.59421 + 0.418224 I :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Zeta[1/2 + 14.3 I] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] -0.0119878 + 0.132231*I ;[o] -0.0119878 + 0.132231 I :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica can do many kinds of exact computations with integers. FactorInteger gives the factors of an integer. ;[s] 5:0,1;11,0;69,3;82,2;83,0;116,-1; 4:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] FactorInteger[70612139395722186] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {{2, 1}, {3, 2}, {43, 5}, {26684839, 1}} :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] You can also do all the standard numerical matrix computations with Mathematica. This computes the inverse of a 2 by 2 matrix. ;[s] 3:0,0;68,1;79,0;128,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Inverse[{{3.5, 7.2}, {-2.4, 6.4}}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {{0.16129, -0.181452}, {0.0604839, 0.0882056}} :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This gives a numerical approximation to the eigenvalues of the matrix computed in the last example. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Eigenvalues[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {0.124748 + 0.0981812 I, 0.124748 - 0.0981812 I} :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica will also solve linear programming problems. This returns a list containing the maximum value of the “objective function” and the point at which it is attained. ;[s] 2:0,1;11,0;175,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] ConstrainedMax[17 x -20 y + 18 z, {x - y + z < 10, x < 5, x + z > 20}, {x, y, z}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {160, {x -> 0, y -> 10, z -> 20}} :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Algebraic Calculations :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] One of the most important features of Mathematica is its ability to deal with mathematical formulas in algebraic form. ;[s] 3:0,0;38,1;49,0;120,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] (1 + x)^3 :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] (1 + x)^3 ;[o] 3 (1 + x) :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This is what Mathematica does if you type in a simple algebraic expression. You can expand out the expression like this: ;[s] 3:0,0;13,1;24,0;122,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Expand[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 1 + 3*x + 3*x^2 + x^3 ;[o] 2 3 1 + 3 x + 3 x + x :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica gives an explicit formula for the result. You can factor this result to get back to what you started from. % always stands for the last result that Mathematica gave you. ;[s] 6:0,1;11,0;120,2;121,0;161,1;172,0;184,-1; 3:3,14,9,Times,0,12,0,0,0;2,14,9,Times,2,12,0,0,0;1,14,10,Courier,0,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Factor[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] (1 + x)^3 ;[o] 3 (1 + x) :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now let's try a more complicated example. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] (1 + 2x + 5y)^7 :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] (1 + 2*x + 5*y)^7 ;[o] 7 (1 + 2 x + 5 y) :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Expand[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] 1 + 14*x + 84*x^2 + 280*x^3 + 560*x^4 + 672*x^5 + 448*x^6 + 128*x^7 + 35*y + 420*x*y + 2100*x^2*y + 5600*x^3*y + 8400*x^4*y + 6720*x^5*y + 2240*x^6*y + 525*y^2 + 5250*x*y^2 + 21000*x^2*y^2 + 42000*x^3*y^2 + 42000*x^4*y^2 + 16800*x^5*y^2 + 4375*y^3 + 35000*x*y^3 + 105000*x^2*y^3 + 140000*x^3*y^3 + 70000*x^4*y^3 + 21875*y^4 + 131250*x*y^4 + 262500*x^2*y^4 + 175000*x^3*y^4 + 65625*y^5 + 262500*x*y^5 + 262500*x^2*y^5 + 109375*y^6 + 218750*x*y^6 + 78125*y^7 ;[o] 2 3 4 5 6 1 + 14 x + 84 x + 280 x + 560 x + 672 x + 448 x + 7 2 3 128 x + 35 y + 420 x y + 2100 x y + 5600 x y + 4 5 6 2 2 8400 x y + 6720 x y + 2240 x y + 525 y + 5250 x y + 2 2 3 2 4 2 5 2 21000 x y + 42000 x y + 42000 x y + 16800 x y + 3 3 2 3 3 3 4375 y + 35000 x y + 105000 x y + 140000 x y + 4 3 4 4 2 4 70000 x y + 21875 y + 131250 x y + 262500 x y + 3 4 5 5 2 5 175000 x y + 65625 y + 262500 x y + 262500 x y + 6 6 7 109375 y + 218750 x y + 78125 y :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Factor[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] (1 + 2*x + 5*y)^7 ;[o] 7 (1 + 2 x + 5 y) :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] With the option setting Trig -> True Mathematica will do algebraic operations using trigonometric identities. ;[s] 5:0,0;24,2;36,0;37,1;49,0;111,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Expand[ Cos[x]^3 Sin[x]^2, Trig -> True] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] Cos[x] Cos[3 x] Cos[5 x] ------ - -------- - -------- 8 16 16 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica also does linear algebra on symbolic matrices. ;[s] 2:0,1;12,0;60,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Inverse[{{a, b}, {c, d}}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] d b {{------------, -(------------)}, -(b c) + a d -(b c) + a d c a {-(------------), ------------}} -(b c) + a d -(b c) + a d :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Calculus :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] You can use Mathematica to do calculus. Here's a simple integral. ;[s] 3:0,0;12,1;23,0;67,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Integrate[x^n, x] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] x^(1 + n)/(1 + n) ;[o] 1 + n x ------ 1 + n :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here's a more complicated example. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Integrate[x/(x^3-1), x] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] (3^(1/2)*ArcTan[(1 + 2*x)/3^(1/2)])/3 + Log[1 - x]/3 - Log[1 + x + x^2]/6 ;[o] 1 + 2 x Sqrt[3] ArcTan[-------] 2 Sqrt[3] Log[1 - x] Log[1 + x + x ] ----------------------- + ---------- - --------------- 3 3 6 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now let's try differentiating again. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] D[%, x] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] -1/(3*(1 - x)) + 2/(3*(1 + (1 + 2*x)^2/3)) - (1 + 2*x)/(6*(1 + x + x^2)) ;[o] -1 2 1 + 2 x --------- + ------------------ - -------------- 3 (1 - x) 2 2 (1 + 2 x) 6 (1 + x + x ) 3 (1 + ----------) 3 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This gives the expression in a different algebraic form. We can get back our original form using Simplify. ;[s] 3:0,0;97,1;105,0;107,-1; 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Simplify[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] x/(-1 + x^3) ;[o] x ------- 3 -1 + x :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica can also give exact solutions to many definite integrals. ;[s] 2:0,1;11,0;71,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Integrate[ Sin[x]^10 Cos[x]^5 / x^10, {x, 0, Infinity}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] 40221457 Pi ----------- 297271296 :[font = text; inactive; preserveAspect; ] Here's another example. :[font = input; preserveAspect; startGroup; ] Integrate[ Log[x] (1 + x^2)^(-2), {x, 0, 1}] :[font = output; output; inactive; preserveAspect; endGroup; ] -(4*Catalan + Pi)/8 ;[o] -(4 Catalan + Pi) ----------------- 8 :[font = text; inactive; preserveAspect; ] Most integrals found in any book of tables can be done by Mathematica. ;[s] 3:0,0;58,1;69,0;71,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; startGroup; ] Integrate[ Log[x]^6/(1 + x^2), {x, 0, 1}] :[font = output; output; inactive; preserveAspect; endGroup; ] (61*Pi^7)/256 ;[o] 7 61 Pi ------ 256 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Many integrals do not have a “closed form solution”. If you give Mathematica such a definite integral it will be returned unevaluated. You can still use N to get a numerical answer. ;[s] 5:0,0;66,1;77,0;155,2;156,0;184,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Times,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Integrate[ Sin[ Sin[x]], {x, 0, Pi}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] Integrate[Sin[Sin[x]], {x, 0, Pi}] :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] N[ % ] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] 1.78649 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica can also solve differential equations. Here is a pair of simultaneous differential equations. The solution you get involves two undetermined coefficients. ;[s] 2:0,1;11,0;168,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] DSolve[{x'[t] == -y[t], y'[t] == x[t]}, {x[t], y[t]}, t] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {{x[t] -> -I t 2 I t 2 I t E (C[1] + E C[1] - I C[2] + I E C[2]) ---------------------------------------------------, 2 y[t] -> -I t 2 I t 2 I t E (I C[1] - I E C[1] + C[2] + E C[2]) ---------------------------------------------------}} 2 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] It is a mathematical fact that most differential equations do not have an explicit symbolic solution. In these cases you can get a numerical approximation to the solution using NDSolve. After the solution is computed it is plotted. ;[s] 3:0,0;177,1;184,0;233,-1; 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] NDSolve[{y''[x] + Sin[x]^2 y'[x] + y[x] == Cos[x]^2, y[0] == 1, y'[0] == 0}, y, {x, 0, 20}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {{y -> InterpolatingFunction[{0., 20.}, <>]}} :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Plot[ Evaluate[ y[x] /. %], {x, 0, 20} ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 282; pictureHeight = 174; endGroup; endGroup; pictureID = 24096; ] :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Solving Equations :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This is how you solve a quadratic equation in Mathematica. ;[s] 3:0,0;46,1;57,0;59,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Solve[x^2 + 2 a x + 1 == 0, x] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] {{x -> (-2*a + (-4 + 4*a^2)^(1/2))/2}, {x -> (-2*a - (-4 + 4*a^2)^(1/2))/2}} ;[o] 2 -2 a + Sqrt[-4 + 4 a ] {{x -> ----------------------}, 2 2 -2 a - Sqrt[-4 + 4 a ] {x -> ----------------------}} 2 :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here's a more complicated example. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Solve[x^5 + 3x + 1 == 0, x] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] {ToRules[Roots[3*x + x^5 == -1, x]]} ;[o] 5 {ToRules[Roots[3 x + x == -1, x]]} :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] It is a fact of mathematics that there is no way to get an exact formula for the solutions of a quintic equation like this. You can nevertheless ask Mathematica to give you numerical results. You get the five complex number roots to the equation. ;[s] 3:0,0;150,1;162,0;250,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] N[%] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] {{x -> -0.839072 - 0.943852*I}, {x -> -0.839072 + 0.943852*I}, {x -> -0.331989}, {x -> 1.00507 - 0.937259*I}, {x -> 1.00507 + 0.937259*I}} ;[o] {{x -> -0.839072 - 0.943852 I}, {x -> -0.839072 + 0.943852 I}, {x -> -0.331989}, {x -> 1.00507 - 0.937259 I}, {x -> 1.00507 + 0.937259 I}} :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] When equations contain complicated functions there is in general no systematic procedure for finding all solutions, even numerically. The Mathematica function FindRoot searches for a numerical solution to an equation, starting at a specified point. ;[s] 5:0,0;139,1;150,0;161,2;169,0;252,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] FindRoot[{Sin[x] == x - y, Cos[y] == x + y}, {x, 1}, {y, 0}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {x -> 0.883402, y -> 0.1105} :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica also has an efficient routine for finding the solution to linear equations. Here's a simple example. ;[s] 2:0,1;12,0;114,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] LinearSolve[{{1.02, 5.9}, {2.87, 1.9}}, {1.9, 1.06}] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {0.176325, 0.291551} :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Graphics :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here is a simple Mathematica plot. ;[s] 3:0,0;17,1;28,0;37,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Plot[Sin[x], {x, 0, 2Pi}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 282; pictureHeight = 174; endGroup; pictureID = 27955; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] There are many options you can specify for a plot. Using Show you can redraw the previous plot with specified options. ;[s] 3:0,0;58,1;62,0;120,-1; 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Show[% , Frame -> True, PlotLabel -> "The Sine Function"] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 282; pictureHeight = 174; endGroup; pictureID = 25175; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now for some three-dimensional graphics. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Plot3D[Sin[x] Sin[3 y] , {x, -2, 2}, {y,-2, 2}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 2; pictureTop = 1; pictureWidth = 282; pictureHeight = 231; endGroup; pictureID = 287; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here is a contour plot of the same function. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Show[ ContourGraphics[ % ], ContourShading -> False, ContourSmoothing -> True] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureWidth = 282; pictureHeight = 282; endGroup; pictureID = 29547; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This generates a three-dimensional parametric surface. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] ParametricPlot3D[ {u Sin[t], u Cos[t], t/3}, {t, 0, 12}, {u, -1, 1}, Ticks -> None] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureWidth = 157; pictureHeight = 252; endGroup; pictureID = 14838; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] Mathematica generates all graphics in PostScript, so that you can resize pictures, and make use of the resolution available on different types of printers. (Note, however, that to save disk space the graphics in this Notebook have been converted into bitmap images, which have lower resolution and do not look as good when resized or printed. The ability to convert images into bitmap form is useful when space is at a premium, and for animations, which are normally not printed.) ;[s] 2:0,1;11,0;483,-1; 2:1,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Animated Graphics :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] You can use sequences of graphics cells in a Notebook as frames in a “movie”. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] For information on other controls for viewing Mathematica movies, see the Notebook Read This First! ;[s] 5:0,0;46,1;57,0;84,2;100,0;101,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This Notebook contains a sample of animation in Mathematica. Due to disk space limitations, this is a simple black and white example. Look at the Color Movie Notebook on your disk for an example of animated color graphics. ;[s] 5:0,0;48,1;59,0;148,2;159,0;226,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] To view the movie: :[font = text; inactive; preserveAspect; blackDot; leftWrapOffset = 54; rightWrapOffset = 431; ] Scroll until the first graphics cell is completely visible in the window. (The movie is shown in this cell.) :[font = text; inactive; preserveAspect; blackDot; leftWrapOffset = 54; rightWrapOffset = 431; ] Double-click the first picture in the sequence to start the movie. Click again anywhere to stop. :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] For information on other controls for viewing Mathematica movies, see the Notebook Read This First! ;[s] 4:0,0;46,1;57,0;84,2;101,-1; 3:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] :[font = input; dontPreserveAspect; startGroup; ] Do[Plot3D[Cos[Sqrt[x^2 + y^2]+Abs[n-2Pi]]/Sqrt[x^2 + y^2 + 1/4], {x,-4Pi,4Pi},{y,-4Pi,4Pi}, PlotPoints->26,Lighting->True,PlotRange->{-2,2}, BoxRatios->{1,1,1},Boxed->False,Axes->None], {n, 0, 2Pi - (2Pi/16), 2Pi/16}] :[font = postscript; PICT; formatAsPICT; output; inactive; Cclosed; preserveAspect; pictureWidth = 377; pictureHeight = 377; startGroup; pictureID = 723; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 24492; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 31605; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 6708; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 26717; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 27420; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 10921; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 12697; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 6985; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 29613; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 28645; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 10514; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 2807; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 6586; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; pictureID = 17882; ] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureWidth = 377; pictureHeight = 377; endGroup; endGroup; endGroup; pictureID = 10876; ] :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Sound :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica can produce not only graphics but also sound. Just as you can use Plot to plot a function, you can also use Play to “play” a function. ;[s] 6:0,1;12,0;79,2;83,0;121,2;125,0;148,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;2,13,9,Courier,1,10,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] To play a sound, double-click the small, speaker-shaped icon at the top of the sound cell bracket. Note: When you double-click the sound cell itself, Mathematica treats it as an animated graphic and plays it repeatedly. To stop, click again anywhere. ;[s] 3:0,0;151,1;162,0;254,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect; ] Here are two examples of sound that use frequency modulation. In the first example the modulating frequency is in the sub-audio range giving a "vibrato" effect. :[font = input; preserveAspect; startGroup; ] Play[Sin[ 2 Pi 440 t + Sin[ 2 Pi 10 t ] ], {t, 0, 1}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; pictureLeft = 83; pictureWidth = 160; pictureHeight = 98; endGroup; pictureID = 11409; soundID = 23682; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This plays a more complex sound. It is the superposition or sum of two modulated waves. :[font = input; dontPreserveAspect; startGroup; ] Play[Sin[1000 t Sin[Mod[100 t, 1]]] + Sin[1000 t ( 1 + 0.1 Sin[100 t])], {t, 0, 3}] :[font = postscript; PICT; formatAsPICT; output; inactive; dontPreserveAspect; pictureWidth = 374; pictureHeight = 98; endGroup; endGroup; pictureID = 7864; soundID = 23241; ] :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Programming in Mathematica ;[s] 3:0,1;15,2;26,1;29,-1; 3:0,19,13,Courier,1,18,0,0,0;2,20,14,Times,1,18,0,0,0;1,20,14,Times,3,18,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] You can use Mathematica not only as a “calculator”, but also as a full symbolic programming language. Many application packages covering specific areas have been or are being written in the Mathematica language. ;[s] 6:0,1;0,0;12,1;23,0;192,1;204,0;215,-1; 2:3,14,9,Times,0,12,0,0,0;3,14,9,Times,2,12,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] A Graphics Application Package :[font = input; preserveAspect; rightWrapOffset = 431; ] Needs["Graphics`Polyhedra`"] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This loads in a package that defines properties of polyhedra. The package defines, among other things, the geometry of a dodecahedron. The Vertices function gives the coordinates for the faces of the given polyhedron. Here are the vertices for a dodecahedron shown in shortened form. ;[s] 3:0,0;139,1;147,0;284,-1; 2:2,14,9,Times,0,12,0,0,0;1,15,10,B Courier Bold,0,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Vertices[ Dodecahedron ] // Short :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] Short[{{0.5257311121191334, 0.3819660112501049, 0.85065080835204}, {-0.2008114158862271, 0.6180339887498946, 0.85065080835204}, {-0.6498393924658123, 0., 0.85065080835204}, {-0.2008114158862271, -0.6180339887498946, 0.85065080835204}, {0.5257311121191334, -0.3819660112501049, 0.85065080835204}, {0.85065080835204, 0.6180339887498946, 0.2008114158862272}, {-0.3249196962329061, 1., 0.2008114158862272}, {-1.051462224238266, 0., 0.2008114158862272}, {-0.3249196962329061, -1., 0.2008114158862272}, {0.85065080835204, -0.6180339887498946, 0.2008114158862272}, {0.3249196962329061, 1., -0.2008114158862272}, {-0.85065080835204, 0.6180339887498949, -0.2008114158862273}, {-0.85065080835204, -0.6180339887498949, -0.2008114158862273}, {0.3249196962329061, -1., -0.2008114158862272}, {1.051462224238266, 0., -0.2008114158862272}, {0.2008114158862272, 0.6180339887498949, -0.85065080835204}, {-0.5257311121191338, 0.3819660112501051, -0.85065080835204}, {-0.5257311121191338, -0.3819660112501051, -0.85065080835204}, {0.2008114158862272, -0.6180339887498949, -0.85065080835204}, {0.6498393924658127, 0., -0.85065080835204}}] ;[o] {{0.525731, 0.381966, 0.850651}, <<18>>, {0.649839, 0., -0.850651}} :[font = text; inactive; preserveAspect; ] This shows the dodecahedron as a three-dimensional graphical object. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Show[ Polyhedron[ Dodecahedron]]; :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 50; pictureWidth = 282; pictureHeight = 277; endGroup; pictureID = 23349; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] As another example, we can use the definitions from the polyhedra package to create an image of a stellated icosahedron, which is often used as an icon for the Mathematica system. ;[s] 3:0,0;162,1;174,0;183,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] Show[ Stellate[ Polyhedron[ Icosahedron ] ] ] ]; :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 50; pictureWidth = 282; pictureHeight = 277; endGroup; endGroup; pictureID = 18089; ] :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Random Walks :[font = text; inactive; preserveAspect; ] These examples illustrate random walks in various dimensions. Mathematica's list operations and plotting routines are combined to give concise programs that generate and then plot the random walks. ;[s] 3:0,0;62,1;73,0;203,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = subsubsection; inactive; preserveAspect; ] One-Dimensional Random Walk ;[s] 3:0,1;3,0;4,1;29,-1; 2:1,17,12,Geneva,1,12,0,0,0;2,14,9,Times,1,12,0,0,0; :[font = input; preserveAspect; ] FoldList[Plus, 0, Table[Random[Real, {-1, 1}], {100}]]; :[font = input; preserveAspect; startGroup; ] ListPlot[%, PlotJoined->True] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 36; pictureWidth = 266; pictureHeight = 164; endGroup; ] %! %%Creator: Mathematica %%AspectRatio: 0.61803 MathPictureStart /Courier findfont 10 scalefont setfont % Scaling calculations 0.0238095 0.00942951 0.0487863 0.0686819 [ [(20)] 0.2124 0.04879 0 2 Msboxa [(40)] 0.40099 0.04879 0 2 Msboxa [(60)] 0.58958 0.04879 0 2 Msboxa [(80)] 0.77817 0.04879 0 2 Msboxa [(100)] 0.96676 0.04879 0 2 Msboxa [(2)] 0.01131 0.18615 1 0 Msboxa [(4)] 0.01131 0.32351 1 0 Msboxa [(6)] 0.01131 0.46088 1 0 Msboxa [(8)] 0.01131 0.59824 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 0.61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath %%Object: Graphics [ ] 0 setdash 0 setgray gsave gsave 0.002 setlinewidth 0.2124 0.04879 moveto 0.2124 0.05504 lineto stroke grestore [(20)] 0.2124 0.04879 0 2 Mshowa gsave 0.002 setlinewidth 0.40099 0.04879 moveto 0.40099 0.05504 lineto stroke grestore [(40)] 0.40099 0.04879 0 2 Mshowa gsave 0.002 setlinewidth 0.58958 0.04879 moveto 0.58958 0.05504 lineto stroke grestore [(60)] 0.58958 0.04879 0 2 Mshowa gsave 0.002 setlinewidth 0.77817 0.04879 moveto 0.77817 0.05504 lineto stroke grestore [(80)] 0.77817 0.04879 0 2 Mshowa gsave 0.002 setlinewidth 0.96676 0.04879 moveto 0.96676 0.05504 lineto stroke grestore [(100)] 0.96676 0.04879 0 2 Mshowa gsave 0.001 setlinewidth 0.06153 0.04879 moveto 0.06153 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.09925 0.04879 moveto 0.09925 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.13696 0.04879 moveto 0.13696 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.17468 0.04879 moveto 0.17468 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.25012 0.04879 moveto 0.25012 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.28784 0.04879 moveto 0.28784 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.32555 0.04879 moveto 0.32555 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.36327 0.04879 moveto 0.36327 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.43871 0.04879 moveto 0.43871 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.47643 0.04879 moveto 0.47643 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.51414 0.04879 moveto 0.51414 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.55186 0.04879 moveto 0.55186 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.6273 0.04879 moveto 0.6273 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.66502 0.04879 moveto 0.66502 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.70273 0.04879 moveto 0.70273 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.74045 0.04879 moveto 0.74045 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.81589 0.04879 moveto 0.81589 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.85361 0.04879 moveto 0.85361 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.89132 0.04879 moveto 0.89132 0.05254 lineto stroke grestore gsave 0.001 setlinewidth 0.92904 0.04879 moveto 0.92904 0.05254 lineto stroke grestore gsave 0.002 setlinewidth 0 0.04879 moveto 1 0.04879 lineto stroke grestore gsave 0.002 setlinewidth 0.02381 0.18615 moveto 0.03006 0.18615 lineto stroke grestore [(2)] 0.01131 0.18615 1 0 Mshowa gsave 0.002 setlinewidth 0.02381 0.32351 moveto 0.03006 0.32351 lineto stroke grestore [(4)] 0.01131 0.32351 1 0 Mshowa gsave 0.002 setlinewidth 0.02381 0.46088 moveto 0.03006 0.46088 lineto stroke grestore [(6)] 0.01131 0.46088 1 0 Mshowa gsave 0.002 setlinewidth 0.02381 0.59824 moveto 0.03006 0.59824 lineto stroke grestore [(8)] 0.01131 0.59824 1 0 Mshowa gsave 0.001 setlinewidth 0.02381 0.07626 moveto 0.02756 0.07626 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.10373 moveto 0.02756 0.10373 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.1312 moveto 0.02756 0.1312 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.15868 moveto 0.02756 0.15868 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.21362 moveto 0.02756 0.21362 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.2411 moveto 0.02756 0.2411 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.26857 moveto 0.02756 0.26857 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.29604 moveto 0.02756 0.29604 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.35099 moveto 0.02756 0.35099 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.37846 moveto 0.02756 0.37846 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.40593 moveto 0.02756 0.40593 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.4334 moveto 0.02756 0.4334 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.48835 moveto 0.02756 0.48835 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.51582 moveto 0.02756 0.51582 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.5433 moveto 0.02756 0.5433 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.57077 moveto 0.02756 0.57077 lineto stroke grestore gsave 0.001 setlinewidth 0.02381 0.02131 moveto 0.02756 0.02131 lineto stroke grestore gsave 0.002 setlinewidth 0.02381 0 moveto 0.02381 0.61803 lineto stroke grestore grestore 0 0 moveto 1 0 lineto 1 0.61803 lineto 0 0.61803 lineto closepath clip newpath 0.004 setlinewidth 0.03324 0.04879 moveto 0.04267 0.02962 lineto 0.0521 0.02466 lineto 0.06153 0.03041 lineto 0.07096 0.03661 lineto 0.08039 0.01472 lineto 0.08982 0.07515 lineto 0.09925 0.14202 lineto 0.10868 0.09754 lineto 0.1181 0.03656 lineto 0.12753 0.09946 lineto 0.13696 0.10628 lineto 0.14639 0.13475 lineto 0.15582 0.13862 lineto 0.16525 0.19873 lineto 0.17468 0.25545 lineto 0.18411 0.29712 lineto 0.19354 0.34977 lineto 0.20297 0.29631 lineto 0.2124 0.26082 lineto 0.22183 0.28129 lineto 0.23126 0.32458 lineto 0.24069 0.26758 lineto 0.25012 0.33569 lineto 0.25955 0.3783 lineto 0.26898 0.34565 lineto 0.27841 0.34639 lineto 0.28784 0.33001 lineto 0.29727 0.31472 lineto 0.30669 0.3455 lineto 0.31612 0.35608 lineto 0.32555 0.40588 lineto 0.33498 0.41727 lineto 0.34441 0.44679 lineto 0.35384 0.42433 lineto 0.36327 0.4525 lineto 0.3727 0.48276 lineto 0.38213 0.54358 lineto 0.39156 0.54632 lineto 0.40099 0.49097 lineto 0.41042 0.46254 lineto 0.41985 0.51893 lineto 0.42928 0.50179 lineto 0.43871 0.50259 lineto 0.44814 0.43427 lineto 0.45757 0.38894 lineto 0.467 0.32327 lineto 0.47643 0.31404 lineto 0.48586 0.32983 lineto 0.49529 0.31385 lineto Mistroke 0.50471 0.35473 lineto 0.51414 0.36692 lineto 0.52357 0.38266 lineto 0.533 0.3399 lineto 0.54243 0.37123 lineto 0.55186 0.42819 lineto 0.56129 0.47255 lineto 0.57072 0.40906 lineto 0.58015 0.38004 lineto 0.58958 0.35984 lineto 0.59901 0.41925 lineto 0.60844 0.47652 lineto 0.61787 0.41156 lineto 0.6273 0.38924 lineto 0.63673 0.34056 lineto 0.64616 0.33456 lineto 0.65559 0.30088 lineto 0.66502 0.35523 lineto 0.67445 0.36456 lineto 0.68388 0.40414 lineto 0.69331 0.37005 lineto 0.70273 0.37282 lineto 0.71216 0.37001 lineto 0.72159 0.43313 lineto 0.73102 0.48561 lineto 0.74045 0.49987 lineto 0.74988 0.53564 lineto 0.75931 0.60332 lineto 0.76874 0.5595 lineto 0.77817 0.51863 lineto 0.7876 0.47133 lineto 0.79703 0.43143 lineto 0.80646 0.36297 lineto 0.81589 0.39202 lineto 0.82532 0.41123 lineto 0.83475 0.35529 lineto 0.84418 0.40279 lineto 0.85361 0.45655 lineto 0.86304 0.44594 lineto 0.87247 0.47973 lineto 0.8819 0.44349 lineto 0.89132 0.38265 lineto 0.90075 0.37926 lineto 0.91018 0.34271 lineto 0.91961 0.28927 lineto 0.92904 0.23603 lineto 0.93847 0.16852 lineto 0.9479 0.18481 lineto 0.95733 0.13821 lineto 0.96676 0.20657 lineto Mistroke 0.97619 0.20915 lineto Mfstroke % End of Graphics MathPictureEnd :[font = subsubsection; inactive; preserveAspect; ] Two-Dimensional Random Walk ;[s] 1:0,1;29,-1; 2:0,17,12,Geneva,1,12,0,0,0;1,14,9,Times,1,12,0,0,0; :[font = input; preserveAspect; ] FoldList[Plus, {0, 0}, Table[Random[Real, {-1, 1}], {100}, {2}]]; :[font = input; preserveAspect; startGroup; ] ListPlot[%, PlotJoined->True] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 36; pictureWidth = 266; pictureHeight = 164; endGroup; ] %! %%Creator: Mathematica %%AspectRatio: 0.61803 MathPictureStart /Courier findfont 10 scalefont setfont % Scaling calculations 0.532661 0.0974204 0.0461965 0.0468417 [ [(-4)] 0.14298 0.0462 0 2 Msboxa [(-2)] 0.33782 0.0462 0 2 Msboxa [(2)] 0.7275 0.0462 0 2 Msboxa [(4)] 0.92234 0.0462 0 2 Msboxa [(2)] 0.52016 0.13988 1 0 Msboxa [(4)] 0.52016 0.23356 1 0 Msboxa [(6)] 0.52016 0.32725 1 0 Msboxa [(8)] 0.52016 0.42093 1 0 Msboxa [(10)] 0.52016 0.51461 1 0 Msboxa [(12)] 0.52016 0.6083 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 0.61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath %%Object: Graphics [ ] 0 setdash 0 setgray gsave gsave 0.002 setlinewidth 0.14298 0.0462 moveto 0.14298 0.05245 lineto stroke grestore [(-4)] 0.14298 0.0462 0 2 Mshowa gsave 0.002 setlinewidth 0.33782 0.0462 moveto 0.33782 0.05245 lineto stroke grestore [(-2)] 0.33782 0.0462 0 2 Mshowa gsave 0.002 setlinewidth 0.7275 0.0462 moveto 0.7275 0.05245 lineto stroke grestore [(2)] 0.7275 0.0462 0 2 Mshowa gsave 0.002 setlinewidth 0.92234 0.0462 moveto 0.92234 0.05245 lineto stroke grestore [(4)] 0.92234 0.0462 0 2 Mshowa gsave 0.001 setlinewidth 0.18195 0.0462 moveto 0.18195 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.22092 0.0462 moveto 0.22092 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.25988 0.0462 moveto 0.25988 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.29885 0.0462 moveto 0.29885 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.37679 0.0462 moveto 0.37679 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.41576 0.0462 moveto 0.41576 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.45472 0.0462 moveto 0.45472 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.49369 0.0462 moveto 0.49369 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.57163 0.0462 moveto 0.57163 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.6106 0.0462 moveto 0.6106 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.64957 0.0462 moveto 0.64957 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.68853 0.0462 moveto 0.68853 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.76647 0.0462 moveto 0.76647 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.80544 0.0462 moveto 0.80544 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.84441 0.0462 moveto 0.84441 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.88337 0.0462 moveto 0.88337 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.10401 0.0462 moveto 0.10401 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.06504 0.0462 moveto 0.06504 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.02607 0.0462 moveto 0.02607 0.04995 lineto stroke grestore gsave 0.001 setlinewidth 0.96131 0.0462 moveto 0.96131 0.04995 lineto stroke grestore gsave 0.002 setlinewidth 0 0.0462 moveto 1 0.0462 lineto stroke grestore gsave 0.002 setlinewidth 0.53266 0.13988 moveto 0.53891 0.13988 lineto stroke grestore [(2)] 0.52016 0.13988 1 0 Mshowa gsave 0.002 setlinewidth 0.53266 0.23356 moveto 0.53891 0.23356 lineto stroke grestore [(4)] 0.52016 0.23356 1 0 Mshowa gsave 0.002 setlinewidth 0.53266 0.32725 moveto 0.53891 0.32725 lineto stroke grestore [(6)] 0.52016 0.32725 1 0 Mshowa gsave 0.002 setlinewidth 0.53266 0.42093 moveto 0.53891 0.42093 lineto stroke grestore [(8)] 0.52016 0.42093 1 0 Mshowa gsave 0.002 setlinewidth 0.53266 0.51461 moveto 0.53891 0.51461 lineto stroke grestore [(10)] 0.52016 0.51461 1 0 Mshowa gsave 0.002 setlinewidth 0.53266 0.6083 moveto 0.53891 0.6083 lineto stroke grestore [(12)] 0.52016 0.6083 1 0 Mshowa gsave 0.001 setlinewidth 0.53266 0.06493 moveto 0.53641 0.06493 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.08367 moveto 0.53641 0.08367 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.10241 moveto 0.53641 0.10241 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.12114 moveto 0.53641 0.12114 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.15862 moveto 0.53641 0.15862 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.17735 moveto 0.53641 0.17735 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.19609 moveto 0.53641 0.19609 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.21483 moveto 0.53641 0.21483 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.2523 moveto 0.53641 0.2523 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.27104 moveto 0.53641 0.27104 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.28977 moveto 0.53641 0.28977 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.30851 moveto 0.53641 0.30851 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.34598 moveto 0.53641 0.34598 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.36472 moveto 0.53641 0.36472 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.38346 moveto 0.53641 0.38346 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.40219 moveto 0.53641 0.40219 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.43967 moveto 0.53641 0.43967 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.4584 moveto 0.53641 0.4584 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.47714 moveto 0.53641 0.47714 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.49588 moveto 0.53641 0.49588 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.53335 moveto 0.53641 0.53335 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.55209 moveto 0.53641 0.55209 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.57082 moveto 0.53641 0.57082 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.58956 moveto 0.53641 0.58956 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.02746 moveto 0.53641 0.02746 lineto stroke grestore gsave 0.001 setlinewidth 0.53266 0.00872 moveto 0.53641 0.00872 lineto stroke grestore gsave 0.002 setlinewidth 0.53266 0 moveto 0.53266 0.61803 lineto stroke grestore grestore 0 0 moveto 1 0 lineto 1 0.61803 lineto 0 0.61803 lineto closepath clip newpath 0.004 setlinewidth 0.53266 0.0462 moveto 0.61164 0.05392 lineto 0.52274 0.05703 lineto 0.61988 0.09643 lineto 0.59489 0.07959 lineto 0.59569 0.11785 lineto 0.62475 0.16134 lineto 0.59908 0.20794 lineto 0.51055 0.23963 lineto 0.47312 0.23876 lineto 0.48882 0.19704 lineto 0.42328 0.17619 lineto 0.36513 0.16653 lineto 0.35876 0.14583 lineto 0.31753 0.13688 lineto 0.32381 0.15577 lineto 0.34039 0.16017 lineto 0.25306 0.13678 lineto 0.29406 0.18099 lineto 0.19714 0.17422 lineto 0.19285 0.13894 lineto 0.13929 0.16452 lineto 0.11983 0.16545 lineto 0.06333 0.17336 lineto 0.08138 0.14942 lineto 0.17566 0.17014 lineto 0.12613 0.1387 lineto 0.04143 0.17588 lineto 0.06921 0.1775 lineto 0.02381 0.21877 lineto 0.05801 0.17792 lineto 0.14037 0.13186 lineto 0.14486 0.17173 lineto 0.12102 0.18613 lineto 0.04314 0.15502 lineto 0.10322 0.13041 lineto 0.15923 0.09221 lineto 0.12632 0.11941 lineto 0.0579 0.09581 lineto 0.13747 0.09722 lineto 0.10137 0.12084 lineto 0.12323 0.08392 lineto 0.12471 0.0848 lineto 0.17034 0.05914 lineto 0.14295 0.05035 lineto 0.16642 0.038 lineto 0.16824 0.01472 lineto 0.23145 0.05142 lineto 0.30803 0.0908 lineto 0.29227 0.08498 lineto Mistroke 0.30232 0.13147 lineto 0.22481 0.12052 lineto 0.17724 0.09381 lineto 0.13631 0.13729 lineto 0.19346 0.1514 lineto 0.28943 0.17512 lineto 0.2403 0.15106 lineto 0.26948 0.16705 lineto 0.33271 0.19037 lineto 0.29017 0.21045 lineto 0.33712 0.18966 lineto 0.41715 0.20529 lineto 0.36416 0.1979 lineto 0.28477 0.24051 lineto 0.34494 0.24472 lineto 0.42671 0.26447 lineto 0.41988 0.28268 lineto 0.49937 0.27231 lineto 0.48202 0.27341 lineto 0.49643 0.2553 lineto 0.58173 0.2631 lineto 0.58991 0.29096 lineto 0.53472 0.33199 lineto 0.512 0.3586 lineto 0.50492 0.32491 lineto 0.5912 0.32778 lineto 0.65641 0.33521 lineto 0.60032 0.33428 lineto 0.57164 0.33619 lineto 0.58218 0.34068 lineto 0.64086 0.31889 lineto 0.70825 0.3128 lineto 0.66131 0.33754 lineto 0.67909 0.37184 lineto 0.71918 0.36817 lineto 0.72455 0.36702 lineto 0.70945 0.38689 lineto 0.69773 0.34417 lineto 0.79034 0.33959 lineto 0.70833 0.31527 lineto 0.66054 0.36169 lineto 0.62615 0.4023 lineto 0.68898 0.437 lineto 0.74051 0.48343 lineto 0.81051 0.50707 lineto 0.83602 0.53505 lineto 0.85022 0.53655 lineto 0.92534 0.51903 lineto 0.96291 0.55581 lineto 0.97619 0.55852 lineto Mistroke 0.91461 0.60332 lineto Mfstroke % End of Graphics MathPictureEnd :[font = subsubsection; inactive; preserveAspect; ] Three-Dimensional Random Walk ;[s] 1:0,1;31,-1; 2:0,17,12,Geneva,1,12,0,0,0;1,14,9,Times,1,12,0,0,0; :[font = input; preserveAspect; ] FoldList[Plus, {0, 0, 0}, Table[Random[Real, {-1, 1}], {100}, {3}]]; :[font = input; preserveAspect; startGroup; ] Show[Graphics3D[Line[%]]] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 36; pictureWidth = 242; pictureHeight = 270; endGroup; endGroup; ] %! %%Creator: Mathematica %%AspectRatio: 1.11356 MathPictureStart /Courier findfont 10 scalefont setfont % Scaling calculations -0.038545 1.13871 0.0284677 1.13871 [ [ 0 0 0 0 ] [ 1 1.11356 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath %%Object: Graphics3D [ ] 0 setdash 0 setgray 0 0 moveto 1 0 lineto 1 1.11356 lineto 0 1.11356 lineto closepath clip newpath gsave 0.002 setlinewidth 0.0993 0.24101 moveto 0.02847 0.7525 lineto stroke 0.02847 0.7525 moveto 0.45855 1.0851 lineto stroke 0.45855 1.0851 moveto 0.46698 0.62263 lineto stroke 0.46698 0.62263 moveto 0.0993 0.24101 lineto stroke 0.61524 0.02847 moveto 0.91605 0.4792 lineto stroke 0.91605 0.4792 moveto 0.97153 0.96226 lineto stroke 0.97153 0.96226 moveto 0.63067 0.55901 lineto stroke 0.63067 0.55901 moveto 0.61524 0.02847 lineto stroke 0.0993 0.24101 moveto 0.02847 0.7525 lineto stroke 0.02847 0.7525 moveto 0.63067 0.55901 lineto stroke 0.63067 0.55901 moveto 0.61524 0.02847 lineto stroke 0.61524 0.02847 moveto 0.0993 0.24101 lineto stroke 0.46698 0.62263 moveto 0.91605 0.4792 lineto stroke 0.91605 0.4792 moveto 0.97153 0.96226 lineto stroke 0.97153 0.96226 moveto 0.45855 1.0851 lineto stroke 0.45855 1.0851 moveto 0.46698 0.62263 lineto stroke grestore gsave 0.004 setlinewidth 0.42129 0.51719 moveto 0.43166 0.48655 lineto stroke grestore gsave 0.004 setlinewidth 0.35479 0.51971 moveto 0.42129 0.51719 lineto stroke grestore gsave 0.004 setlinewidth 0.3279 0.55289 moveto 0.35479 0.51971 lineto stroke grestore gsave 0.004 setlinewidth 0.45491 0.5491 moveto 0.39821 0.55312 lineto stroke grestore gsave 0.004 setlinewidth 0.48476 0.56392 moveto 0.45491 0.5491 lineto stroke grestore gsave 0.004 setlinewidth 0.50424 0.49169 moveto 0.41848 0.443 lineto stroke grestore gsave 0.004 setlinewidth 0.79368 0.62206 moveto 0.77851 0.62562 lineto stroke grestore gsave 0.004 setlinewidth 0.81926 0.63286 moveto 0.79368 0.62206 lineto stroke grestore gsave 0.004 setlinewidth 0.39821 0.55312 moveto 0.3279 0.55289 lineto stroke grestore gsave 0.004 setlinewidth 0.78854 0.68064 moveto 0.8192 0.65011 lineto stroke grestore gsave 0.004 setlinewidth 0.72785 0.65001 moveto 0.78854 0.68064 lineto stroke grestore gsave 0.004 setlinewidth 0.43166 0.48655 moveto 0.50424 0.49169 lineto stroke grestore gsave 0.004 setlinewidth 0.7613 0.67084 moveto 0.72785 0.65001 lineto stroke grestore gsave 0.004 setlinewidth 0.42929 0.49644 moveto 0.44376 0.53394 lineto stroke grestore gsave 0.004 setlinewidth 0.47535 0.46911 moveto 0.42929 0.49644 lineto stroke grestore gsave 0.004 setlinewidth 0.44376 0.53394 moveto 0.45306 0.51319 lineto stroke grestore gsave 0.004 setlinewidth 0.52963 0.49811 moveto 0.47535 0.46911 lineto stroke grestore gsave 0.004 setlinewidth 0.45306 0.51319 moveto 0.48476 0.56392 lineto stroke grestore gsave 0.004 setlinewidth 0.56957 0.49488 moveto 0.50187 0.47203 lineto stroke grestore gsave 0.004 setlinewidth 0.54683 0.49645 moveto 0.56957 0.49488 lineto stroke grestore gsave 0.004 setlinewidth 0.90293 0.6536 moveto 0.81926 0.63286 lineto stroke grestore gsave 0.004 setlinewidth 0.8192 0.65011 moveto 0.90293 0.6536 lineto stroke grestore gsave 0.004 setlinewidth 0.77851 0.62562 moveto 0.73298 0.62002 lineto stroke grestore gsave 0.004 setlinewidth 0.50187 0.47203 moveto 0.52963 0.49811 lineto stroke grestore gsave 0.004 setlinewidth 0.70471 0.68255 moveto 0.73276 0.67066 lineto stroke grestore gsave 0.004 setlinewidth 0.62414 0.71972 moveto 0.70471 0.68255 lineto stroke grestore gsave 0.004 setlinewidth 0.73276 0.67066 moveto 0.7613 0.67084 lineto stroke grestore gsave 0.004 setlinewidth 0.62831 0.52492 moveto 0.54683 0.49645 lineto stroke grestore gsave 0.004 setlinewidth 0.62462 0.53431 moveto 0.62831 0.52492 lineto stroke grestore gsave 0.004 setlinewidth 0.60495 0.76854 moveto 0.62414 0.71972 lineto stroke grestore gsave 0.004 setlinewidth 0.73298 0.62002 moveto 0.7032 0.63741 lineto stroke grestore gsave 0.004 setlinewidth 0.44396 0.52946 moveto 0.35764 0.53905 lineto stroke grestore gsave 0.004 setlinewidth 0.49673 0.57431 moveto 0.44396 0.52946 lineto stroke grestore gsave 0.004 setlinewidth 0.64455 0.77669 moveto 0.60495 0.76854 lineto stroke grestore gsave 0.004 setlinewidth 0.61964 0.65015 moveto 0.57263 0.58092 lineto stroke grestore gsave 0.004 setlinewidth 0.6177 0.63292 moveto 0.61964 0.65015 lineto stroke grestore gsave 0.004 setlinewidth 0.57263 0.58092 moveto 0.49673 0.57431 lineto stroke grestore gsave 0.004 setlinewidth 0.69813 0.66498 moveto 0.67097 0.68467 lineto stroke grestore gsave 0.004 setlinewidth 0.68695 0.6046 moveto 0.69813 0.66498 lineto stroke grestore gsave 0.004 setlinewidth 0.74018 0.56421 moveto 0.68695 0.6046 lineto stroke grestore gsave 0.004 setlinewidth 0.68411 0.55623 moveto 0.74018 0.56421 lineto stroke grestore gsave 0.004 setlinewidth 0.57388 0.55993 moveto 0.64773 0.60362 lineto stroke grestore gsave 0.004 setlinewidth 0.60371 0.59145 moveto 0.57388 0.55993 lineto stroke grestore gsave 0.004 setlinewidth 0.61885 0.66043 moveto 0.60371 0.59145 lineto stroke grestore gsave 0.004 setlinewidth 0.60192 0.63018 moveto 0.61885 0.66043 lineto stroke grestore gsave 0.004 setlinewidth 0.35764 0.53905 moveto 0.29898 0.58854 lineto stroke grestore gsave 0.004 setlinewidth 0.67097 0.68467 moveto 0.6177 0.63292 lineto stroke grestore gsave 0.004 setlinewidth 0.64773 0.60362 moveto 0.69948 0.5775 lineto stroke grestore gsave 0.004 setlinewidth 0.7032 0.63741 moveto 0.68411 0.55623 lineto stroke grestore gsave 0.004 setlinewidth 0.7298 0.58276 moveto 0.67726 0.53162 lineto stroke grestore gsave 0.004 setlinewidth 0.7105 0.58836 moveto 0.7298 0.58276 lineto stroke grestore gsave 0.004 setlinewidth 0.29898 0.58854 moveto 0.37373 0.62749 lineto stroke grestore gsave 0.004 setlinewidth 0.67726 0.53162 moveto 0.62462 0.53431 lineto stroke grestore gsave 0.004 setlinewidth 0.63891 0.80129 moveto 0.64455 0.77669 lineto stroke grestore gsave 0.004 setlinewidth 0.4328 0.63675 moveto 0.41946 0.57405 lineto stroke grestore gsave 0.004 setlinewidth 0.37373 0.62749 moveto 0.4328 0.63675 lineto stroke grestore gsave 0.004 setlinewidth 0.60427 0.66042 moveto 0.60192 0.63018 lineto stroke grestore gsave 0.004 setlinewidth 0.65401 0.58936 moveto 0.7105 0.58836 lineto stroke grestore gsave 0.004 setlinewidth 0.69948 0.5775 moveto 0.65401 0.58936 lineto stroke grestore gsave 0.004 setlinewidth 0.45992 0.50175 moveto 0.48209 0.49971 lineto stroke grestore gsave 0.004 setlinewidth 0.41946 0.57405 moveto 0.45992 0.50175 lineto stroke grestore gsave 0.004 setlinewidth 0.53135 0.63243 moveto 0.60427 0.66042 lineto stroke grestore gsave 0.004 setlinewidth 0.5713 0.5606 moveto 0.53135 0.63243 lineto stroke grestore gsave 0.004 setlinewidth 0.63884 0.68023 moveto 0.58635 0.65571 lineto stroke grestore gsave 0.004 setlinewidth 0.62034 0.66469 moveto 0.63884 0.68023 lineto stroke grestore gsave 0.004 setlinewidth 0.61318 0.52733 moveto 0.5713 0.5606 lineto stroke grestore gsave 0.004 setlinewidth 0.49712 0.44358 moveto 0.52988 0.48896 lineto stroke grestore gsave 0.004 setlinewidth 0.53853 0.4536 moveto 0.49712 0.44358 lineto stroke grestore gsave 0.004 setlinewidth 0.58635 0.65571 moveto 0.66854 0.72616 lineto stroke grestore gsave 0.004 setlinewidth 0.66854 0.72616 moveto 0.63891 0.80129 lineto stroke grestore gsave 0.004 setlinewidth 0.5372 0.4841 moveto 0.53853 0.4536 lineto stroke grestore gsave 0.004 setlinewidth 0.48209 0.49971 moveto 0.5372 0.4841 lineto stroke grestore gsave 0.004 setlinewidth 0.6585 0.68045 moveto 0.62034 0.66469 lineto stroke grestore gsave 0.004 setlinewidth 0.6113 0.67891 moveto 0.6585 0.68045 lineto stroke grestore gsave 0.004 setlinewidth 0.67533 0.72684 moveto 0.6113 0.67891 lineto stroke grestore gsave 0.004 setlinewidth 0.52988 0.48896 moveto 0.61318 0.52733 lineto stroke grestore gsave 0.004 setlinewidth 0.60526 0.80874 moveto 0.67533 0.72684 lineto stroke grestore gsave 0.004 setlinewidth 0.62946 0.70296 moveto 0.60526 0.80874 lineto stroke grestore gsave 0.004 setlinewidth 0.63892 0.59819 moveto 0.62946 0.70296 lineto stroke grestore gsave 0.004 setlinewidth 0.63296 0.53689 moveto 0.63892 0.59819 lineto stroke grestore gsave 0.004 setlinewidth 0.57352 0.46781 moveto 0.63296 0.53689 lineto stroke grestore gsave 0.004 setlinewidth 0.56979 0.46994 moveto 0.57352 0.46781 lineto stroke grestore gsave 0.004 setlinewidth 0.49417 0.4618 moveto 0.51317 0.46662 lineto stroke grestore gsave 0.004 setlinewidth 0.50834 0.48232 moveto 0.49417 0.4618 lineto stroke grestore gsave 0.004 setlinewidth 0.48562 0.56845 moveto 0.53845 0.5741 lineto stroke grestore gsave 0.004 setlinewidth 0.50017 0.57389 moveto 0.48562 0.56845 lineto stroke grestore gsave 0.004 setlinewidth 0.55119 0.48146 moveto 0.56979 0.46994 lineto stroke grestore gsave 0.004 setlinewidth 0.50666 0.52652 moveto 0.56908 0.53454 lineto stroke grestore gsave 0.004 setlinewidth 0.49551 0.57633 moveto 0.50666 0.52652 lineto stroke grestore gsave 0.004 setlinewidth 0.53072 0.48353 moveto 0.49551 0.57633 lineto stroke grestore gsave 0.004 setlinewidth 0.56908 0.53454 moveto 0.55119 0.48146 lineto stroke grestore gsave 0.004 setlinewidth 0.6159 0.6073 moveto 0.68483 0.55892 lineto stroke grestore gsave 0.004 setlinewidth 0.59366 0.6578 moveto 0.6159 0.6073 lineto stroke grestore gsave 0.004 setlinewidth 0.48847 0.47621 moveto 0.50017 0.57389 lineto stroke grestore gsave 0.004 setlinewidth 0.51317 0.46662 moveto 0.48847 0.47621 lineto stroke grestore gsave 0.004 setlinewidth 0.57118 0.43323 moveto 0.50834 0.48232 lineto stroke grestore gsave 0.004 setlinewidth 0.5052 0.54787 moveto 0.53072 0.48353 lineto stroke grestore gsave 0.004 setlinewidth 0.68483 0.55892 moveto 0.61838 0.54469 lineto stroke grestore gsave 0.004 setlinewidth 0.61838 0.54469 moveto 0.57118 0.43323 lineto stroke grestore gsave 0.004 setlinewidth 0.53845 0.5741 moveto 0.5052 0.54787 lineto stroke grestore gsave 0.002 setlinewidth 0.61524 0.02847 moveto 0.91605 0.4792 lineto stroke 0.91605 0.4792 moveto 0.97153 0.96226 lineto stroke 0.97153 0.96226 moveto 0.63067 0.55901 lineto stroke 0.63067 0.55901 moveto 0.61524 0.02847 lineto stroke 0.0993 0.24101 moveto 0.02847 0.7525 lineto stroke 0.02847 0.7525 moveto 0.63067 0.55901 lineto stroke 0.63067 0.55901 moveto 0.61524 0.02847 lineto stroke 0.61524 0.02847 moveto 0.0993 0.24101 lineto stroke grestore gsave grestore % End of Graphics MathPictureEnd :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] More on Programming :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] There are several styles of programming in Mathematica. One of them is procedural programming, as you would find in a standard structured programming language such as C or Pascal. Another is “rule-based programming”. The idea is to give transformation rules which specify how Mathematica should transform expressions it receives as input. You can give rules that mimic the formulas you might find in a mathematics textbook. Here is an example of how you might teach Mathematica about a new form of logarithm function, called nlog. ;[s] 9:0,0;43,1;54,0;279,1;290,0;473,1;484,0;533,2;537,0;539,-1; 3:5,14,9,Times,0,12,0,0,0;3,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] nlog[a b c d^2] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] nlog[a*b*c*d^2] ;[o] 2 nlog[a b c d ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica initially knows nothing about our new function, so it does nothing to expressions involving nlog. ;[s] 4:0,1;12,0;105,2;109,0;111,-1; 3:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; ] nlog[x_ y_] := nlog[x] + nlog[y] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This tells Mathematica how to expand out logarithms of products. ;[s] 3:0,0;11,1;22,0;66,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] nlog[a b c d^2] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] nlog[a] + nlog[b] + nlog[c] + nlog[d^2] ;[o] 2 nlog[a] + nlog[b] + nlog[c] + nlog[d ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now Mathematica can expand the nlog out. ;[s] 5:0,0;4,1;15,0;32,2;36,0;43,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; ] nlog[x_^n_] := n nlog[x] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This gives a rule for nlog of a power. ;[s] 3:0,0;22,1;26,0;39,-1; 2:2,14,9,Times,0,12,0,0,0;1,13,9,Courier,1,10,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] nlog[a b c d^2] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; ] nlog[a] + nlog[b] + nlog[c] + 2*nlog[d] ;[o] nlog[a] + nlog[b] + nlog[c] + 2 nlog[d] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Now Mathematica can expand the expression out completely. ;[s] 3:0,0;4,1;15,0;59,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Another style of programming you can use in Mathematica is functional programming. In functional programming, you specify a collection of functions to apply. This style of programming often yields compact, elegant programs that make good use of Mathematica's many integrated capabilities. ;[s] 5:0,0;44,1;55,0;248,1;259,0;292,-1; 2:3,14,9,Times,0,12,0,0,0;2,14,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This is a program that plots the solutions to a polynomial equation as points in the complex plane. :[font = input; preserveAspect; rightWrapOffset = 431; ] RootPlot[poly_, z] := ListPlot[{Re[z], Im[z]} /. NSolve[ poly == 0, z], AspectRatio -> Automatic ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] You can immediately use the program to plot solutions. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] RootPlot[ z^7 - 1 , z]; :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 17; pictureWidth = 279; pictureHeight = 287; endGroup; pictureID = 26961; ] :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here is a program written in functional programming style, which finds the first n terms in the continued fraction decomposition of the number x. :[font = input; preserveAspect; rightWrapOffset = 431; ] ContinuedFraction[x_Real, n_Integer] := Floor[ NestList[ Function[{u}, 1/(u - Floor[u])], x, n - 1] ] :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] ContinuedFraction[.34252515, 7] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] {0, 2, 1, 11, 2, 2, 1} :[font = section; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] The Mathematica User Interface ;[s] 3:0,1;4,2;15,1;31,-1; 3:0,19,13,Courier,1,18,0,0,0;2,20,14,Times,1,18,0,0,0;1,20,14,Times,3,18,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Mathematica consists of two parts — the “kernel”, which actually does computations, and the “front end”, which deals with interaction with the user. The kernel of Mathematica is essentially the same on all computers that support Mathematica. The front end, on the other hand, works differently on different kinds of computer. On the Macintosh, Mathematica has a sophisticated front end that takes advantage of the Macintosh's unique user interface capabilities. (You can actually use the Macintosh front end even if you are using a “remote kernel”, say on a supercomputer connected through a network.) ;[s] 8:0,1;11,0;165,1;176,0;232,1;243,0;350,1;361,0;610,-1; 2:4,14,9,Times,0,12,0,0,0;4,14,9,Times,2,12,0,0,0; :[font = subsection; inactive; preserveAspect; rightWrapOffset = 431; startGroup; ] Notebooks :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] One of the most important aspects of the Macintosh front end is its ability to support Mathematica “Notebooks”. This file is an example of a Notebook. Notebooks consist of a mixture of text, graphics, sounds and Mathematica input. Notebooks can be used like “interactive textbooks” — you read the text in the Notebook, then use the Mathematica input in the Notebook to perform calculations. ;[s] 7:0,0;87,1;98,0;217,1;229,0;339,1;350,0;399,-1; 2:4,14,9,Times,0,12,0,0,0;3,14,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Here is a sample Mathematica Notebook called Point Plots and Space Curves. ;[s] 5:0,0;17,1;29,0;46,2;74,0;78,-1; 3:3,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0;1,14,9,Times,1,12,0,0,0; :[font = title; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; fontName = "B Helvetica Bold"startGroup; ] Point Plots and Space Curves by Theodore W. Gray ;[s] 4:0,1;28,0;29,2;48,0;49,-1; 3:2,24,17,Courier,1,24,0,0,0;1,18,12,B Helvetica Bold,1,14,0,0,0;1,15,10,B Helvetica Bold,3,12,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] This Notebook defines the functions PointPlot, PointPlot3D, PointParamPlot3D, SpaceCurve, and PointSpaceCurve. These functions let you make discrete point plots in two and three dimensions. The SpaceCurve and PointSpaceCurve functions let you make three-dimensional functions of one parameter (lines or points in 3D). ;[s] 11:0,0;36,1;45,0;47,1;58,0;60,1;76,0;78,1;88,0;94,1;109,0;320,-1; 2:6,14,9,Times,0,12,0,0,0;5,14,9,Times,1,12,0,0,0; :[font = section; inactive; preserveAspect; rightWrapOffset = 431; startGroup; ] Examples :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] Each of the functions defined in this Notebook is a variation of either Plot, Plot3D, or ParametricPlot3D. The arguments are quite similar to these standard functions. Following are descriptions of each of the functions. ;[s] 7:0,0;72,1;76,0;78,1;84,0;89,1;105,0;224,-1; 2:4,14,9,Times,0,12,0,0,0;3,13,9,Times,1,10,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] PointPlot ;[s] 2:0,1;9,0;10,-1; 2:1,20,14,Geneva,1,14,0,0,0;1,17,12,Times,1,14,0,0,0; :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] PointPlot[ f, {x, min, max, (step)}] produces a plot of f(x) vs. x. Here is an example: ;[s] 3:0,0;61,1;64,0;89,-1; 2:2,14,9,Times,0,12,0,0,0;1,14,9,Times,2,12,0,0,0; :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] PointPlot[Sin[x], {x, 0, 2 Pi, 0.2}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 67; pictureWidth = 243; pictureHeight = 147; pictureID = 8261; ] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] -Graphics- :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] PointPlot3D :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] PointPlot3D[ f, {x, min, max, (step)}, {y, min, max, (step)}] produces a plot of f(x, y), plotted with points instead of surfaces. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] PointPlot3D[x y, {x, -4, 4, 0.5}, {y, -4, 4, 0.5}, BoxRatios->{1,1,1}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 107; pictureWidth = 202; pictureHeight = 198; pictureID = 8228; ] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] -Graphics3D- :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] PointParamPlot3D :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] PointParamPlot3D[{x,y,z}, {u, min, max, (step)}, {v, min, max, (step)}] produces a parametric plot of (x(u,v), y(u,v), z(u,v)), plotted with points instead of surfaces. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] PointParamPlot3D[{Sin[u] Cos[v], Sin[u] Sin[v], Cos[u]}, {u, 0, Pi, Pi/15}, {v, 0, 2 Pi, Pi/15}, BoxRatios->{1,1,1}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 113; pictureWidth = 205; pictureHeight = 201; pictureID = 28252; ] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] -Graphics3D- :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] SpaceCurve :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] SpaceCurve[{x,y,z}, {u, min, max, (step)}] produces a parametric plot of (x(u), y(u), z(u)), with the calculated points connected by straight lines. :[font = input; preserveAspect; rightWrapOffset = 431; startGroup; ] SpaceCurve[{u Sin[u], u Cos[u], u}, {u, 0, 15, 0.15}, BoxRatios->{1,1,1}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 107; pictureWidth = 202; pictureHeight = 198; pictureID = 14918; ] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] -Graphics3D- :[font = subsection; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] PointSpaceCurve :[font = text; inactive; preserveAspect; rightWrapOffset = 431; ] PointSpaceCurve[{x,y,z}, {u, min, max, (step)}] produces a parametric plot of (x(u), y(u), z(u)), with the calculated points shown as dots. :[font = input; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] PointSpaceCurve[{u Sin[u], u Cos[u], u^2}, {u, 0, 15, 0.30}, BoxRatios->{1,1,1}] :[font = postscript; PICT; formatAsPICT; output; inactive; preserveAspect; rightWrapOffset = 431; pictureLeft = 114; pictureWidth = 198; pictureHeight = 194; pictureID = 23298; ] :[font = output; output; inactive; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; ] The Unformatted text for this cell was not generated. Use options in the Actions Settings dialog box to control when Unformatted text is generated. ;[o] -Graphics3D- :[font = section; inactive; Cclosed; pageBreak; preserveAspect; rightWrapOffset = 431; startGroup; ] Implementation :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Remove previous definitions for the functions defined in this file: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Remove[PointPlot, PointParamPlot3D, PointPlot3D, SpaceCurve, PointSpaceCurve]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Begin this package: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] BeginPackage["PointPlots`"]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Define the usage strings for each of the functions: :[font = input; preserveAspect; rightWrapOffset = 431; ] PointPlot::usage = "PointPlot[f, {u, u0, u1, (du)}], (options)] \ produces a 2D plot made out of points. \ Options are passed to Show[]"; :[font = input; preserveAspect; rightWrapOffset = 431; ] PointPlot3D::usage = "PointPlot3D[f, {x, x0, x1, (dx)}, \ {y, y0, y1, (dy)}, (options)] \ produces a 3D plot made out of points. \ Options are passed to Show[]"; :[font = input; preserveAspect; rightWrapOffset = 431; ] PointParamPlot3D::usage = "PointParamPlot3D[{x, y, z}, {u, u0, u1, (du)}, \ {v, v0, v1, (dv)}, (options)] \ produces a 3D parametric plot made out of points. \ Options are passed to Show[]"; :[font = input; preserveAspect; rightWrapOffset = 431; ] SpaceCurve::usage = "SpaceCurve[{x, y, z}, {u, u0, u1, (du)}, \ (options)] \ produces a 3D space curve. \ Options are passed to Show[]"; :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] PointSpaceCurve::usage = "PointSpaceCurve[{x, y, z}, \ {u, u0, u1, (du)}, (options)] \ produces a set of points in 3D. \ Options are passed to Show[]"; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Begin the private part of this package: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Begin["`Private`"]; `plotpoints = PlotPoints /. Options[Plot3D]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Define PointPlot: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Attributes[PointPlot] = {HoldFirst}; PointPlot[function_, range:{x_,___}, options___] := ListPlot[Table[{x, function}, range], options]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Define PointParamPlot3D: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Attributes[PointParamPlot3D] = {HoldFirst}; PointParamPlot3D[fun:{_, _, _}, {u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, {v_, v0_, v1_, dv_:((v1-v0)/(plotpoints-1))}, opts___] := Show[Graphics3D[Table[Point[N[fun]], {u, u0, u1, du}, {v, v0, v1, dv}]], opts]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Define PointPlot3D (in terms of PointParamPlot3D): :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Attributes[PointPlot3D] = {HoldFirst}; PointPlot3D[fun_, ulim:{u_, ___}, vlim:{v_, ___}, opts___] := PointParamPlot3D[ {u, v, fun}, ulim, vlim, opts]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Define SpaceCurve: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Attributes[SpaceCurve] = {HoldFirst}; SpaceCurve[fun:{_, _, _}, {u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, opts___] := Show[Graphics3D[Line[Table[N[fun], {u,u0,u1,du}]]], opts]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] Define PointSpaceCurve: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; ] Attributes[PointSpaceCurve] = {HoldFirst} PointSpaceCurve[fun:{_, _, _}, {u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, opts___] := Show[Graphics3D[Table[Point[N[fun]], {u,u0,u1,du}]], opts]; :[font = text; inactive; Cclosed; preserveAspect; rightWrapOffset = 431; startGroup; ] End this package: :[font = input; preserveAspect; rightWrapOffset = 431; endGroup; endGroup; endGroup; endGroup; endGroup; endGroup; ] End[]; EndPackage[]; ^*)